package com.iflytek.utils;
import java.util.ArrayList;

import com.qcloud.sms.SmsSingleSender;
import com.qcloud.sms.SmsSingleSenderResult;

public class SmsSDKUtils {
    public static void sendMessageCode(String phoneNumber,String messageCode) {
    	try {
    		//请根据实际 appid 和 appkey 进行开发，以下只作为演示 sdk 使用
			//appid,appkey,templId申请方式可参考接入指南 https://www.qcloud.com/document/product/382/3785#5-.E7.9F.AD.E4.BF.A1.E5.86.85.E5.AE.B9.E9.85.8D.E7.BD.AE
    		int tmplId = 51988;
    		int appid = 1400046962;
    		String appkey = "e371eb0e88604ac521e0a078f6e224e3";
    		 //初始化单发
	    	SmsSingleSender singleSender = new SmsSingleSender(appid, appkey);
	    	SmsSingleSenderResult singleSenderResult;
	    	ArrayList<String> params = new ArrayList<>();
			//String phoneNumber1 = "18756977548";
	    	params.add(messageCode);
	    	params.add("2");
	    	
	    	singleSenderResult = singleSender.sendWithParam("86", phoneNumber, tmplId, params, "", "", "");
	    	System.out.println(singleSenderResult);
    	} catch (Exception e) {
			e.printStackTrace();
		}
    }
}
